export default class ApiAdaptor {
  static pageAdaptor (pageResult, convertor = null) {
    if (pageResult) {
      return {
        data: this.rowsAdaptor(pageResult.data, convertor),
        total: pageResult.total
      }
    }
    return {
      data: [],
      total: 0
    }
  }

  static rowsAdaptor (dataList, convertor) {
    return convertor ? (dataList || []).map(convertor) : []
  }
}
